<template>
  <el-dialog title="不通过" :visible.sync="open" width="35%" style="margin-top: 8%" append-to-body :before-close="closeDelDialog">
    <el-table v-loading="loading" :data="dataList" :tableHeight="tableHeight">
      <el-table-column label="序号" type="index" :index="table_index" width="55" align="center" prop="id"/>
      <el-table-column label="标题" prop="message" align="center" :show-overflow-tooltip="true" />
      <el-table-column label="档号" prop="checkDh" align="center" />
      <el-table-column label="检测时间" prop="detectionTime" align="center" />
    </el-table>
    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"/>
  </el-dialog>
</template>

<script>
import {

    getDetail
} from "@/api/archive/fileCollection/fileOrganization.js"

export default {
  name: "failList",
  props: ["open"],
  data() {
    return {
      loading: true,
      dataList: [],
      queryParams: {
        pageNum: 1,
        pageSize: 10
      },
      total: 0,
      daId: undefined,
      tableHeight: "",
    }
  },
  methods: {
    init(daId) {
      this.daId = daId
      console.log(this.daId,"lksdjfdklsjfklsdjfkl")
      this.getList()
    },
    //动态设置table的高度
    tableHeightData() {
      this.$nextTick(
        () => {
          let h = document.documentElement.clientHeight
          h = h - 200
          if (this.$refs.queryForm) { // 页面上如果有面包屑区域徐减去它的高度
            h = h - this.$refs.queryForm.$el.offsetHeight
          }

          if (this.$refs.refbut) { // 页面上如果有分页区域徐减去它的高度
            h = h - this.$refs.refbut.$el.offsetHeight
          }
          this.tableHeight = h > 500 ? h : 500 // 根据自己项目定高度
          return h
        }
      )
    },
    getList() {
      this.queryParams.daId = this.daId
      getDetail(this.queryParams).then(response=>{
        console.log(response)
        this.dataList = response.rows
        this.total = response.total
        this.loading = false
        this.tableHeightData();
      })

    },
    table_index(index){
      return (this.queryParams.pageNum-1) * this.queryParams.pageSize + index + 1;
    },
    //关闭页面
    closeDelDialog() {
      this.$emit("cancel")
    },
  }
}
</script>

<style scoped>

</style>
